import yaml

class getData:
    @classmethod
    def get_login_data(cls):
        """获取登录的字典数据,返回的是列表嵌套字典"""
        login_data = []
        with open("../data/login_data/loginFail_data.yml", encoding='utf-8') as data:
            Data = yaml.load(data, Loader=yaml.FullLoader)
            for case_data in Data:
                login_data.append(dict(case_data))
        return login_data
    @classmethod
    def get_interface_Data(cls):
        """获取登录接口参数数据，用于测试多参和少参的情况，返回的是列表嵌套字典"""
        login_pa_data=[]
        with open('../data/login_data/Interface_parame_count.yml',encoding='utf-8') as data:
            Data=yaml.load(data,Loader=yaml.FullLoader)
            for case_data in Data:
                login_pa_data.append(case_data)
        return login_pa_data
    @classmethod
    def get_headers(cls):
        """获取请求头"""
        with open('../data/login_data/bl_head_url.yml', encoding='utf-8') as data:
            Data = yaml.load(data, Loader=yaml.FullLoader)
            headers = dict(Data.get('headers'))
        return headers

    @classmethod
    def get_url(cls):
        """获取url"""
        with open('../data/login_data/bl_head_url.yml', encoding='utf-8') as data:
            Data = yaml.load(data, Loader=yaml.FullLoader)
            url = Data.get('Url').get('url')
        return url
if __name__ == '__main__':
    print(getData.get_login_data())